#include <stdio.h>

#define MAXSIZE 255

typedef struct {
    char ch[MAXSIZE];
    int length;
}SString;

// string t, array next
void get_next(SString t, int next[]) {
    int i=1, j=0;
    next[1] = 0; // start with 0 (NEXT)
    while (i < t.length) {
        if (j == 0 || t.ch[i] == t.ch[j]) { //1.j=0  2.ch[i]==ch[j]
            ++i;
            ++j;
            next[i] = j;
        } else {
            j = next[j];
        }
    }
}

int Index_kmp(SString s, SString t, int next[]) {
    int i = 1, j = 1;
    while (i <= s.length && j <= t.length) {
        if (j == 0 || s.ch[i] == t.ch[j]) { // i & j need to move (j==0 or char match)
            ++i;
            ++j;
        } else {
            j=next[j]; // i not move, j -> next[j]
        }
    }
    if (j > t.length) return i - t.length;
    else return 0;



}

int main() {

}